import { useEffect, useState } from 'react'

const TimerComponent = () => {
  let [count, setCount] = useState(0)
  useEffect(() => {
    console.log(1234561)
    const timer = setInterval(() => setCount((count) => count + 1), 1000)
    return () => {
      console.log('*****', 'unmount TimerComponent')
      clearInterval(timer)
    }
  }, [])
  return <h3>{count}</h3>
}

export default TimerComponent
